package com.tangw.management.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.tangw.management.model.User;

/**
 * 
 * @author TangW
 * @version 1.0
 *
 */
public interface UserDao extends JpaRepository<User, Long> {

	public User findByUsername(String username);

	public User findUserById(Integer id);

	@Modifying
	@Query("update S_USERS u set u.realname = ?1 ,u.age= ?2 where u.id = ?3")
	public int updateUser(String realname, Integer age, Integer id);

	@Modifying
	@Query("delete from S_USERS where id = ?1")
	public int delete(Integer id);

}
